var imgs= document.getElementById("left").getElementsByTagName("img");
for(var i = 0;i<imgs.length;i++){
    imgs[i].index = i+1;
    imgs[i].index1 = i;
    imgs[i].onclick = function(){
        tu.src = "images/boy2_0"+this.index+".png";
        for(var h=0;h<imgs.length;h++){
            imgs[h].style.border = "";
        }
        imgs[this.index1].style.border = "1px solid black";
    }
}

var inputon= document.getElementById("size").getElementsByTagName("input");
for(var m = 0;m<inputon.length;m++) {
        inputon[m].onclick = function () {
            for(var k=0;k<inputon.length;k++){
                inputon[k].style.backgroundColor = 'white';
                inputon[k].style.color = 'black';
            }
            this.style.backgroundColor = 'hotpink';
            this.style.color = 'white'
    }
}


var amounts = document.getElementsByName("amounts");
var jiabtns = document.getElementsByName("jia");
var jianbtns = document.getElementsByName("jian");

for(var j=0;j<jianbtns.length;j++){
    jianbtns[j].index = j;
    jianbtns[j].onclick = function(){
        var k = this.index;
        if(amounts[k].value>1){
            amounts[k].value = parseInt(amounts[k].value)-1;
        }
    }
}

for(var i=0;i<jiabtns.length;i++){
    jiabtns[i].index = i;
    jiabtns[i].onclick = function(){
        var g = this.index;
        amounts[g].value = parseInt(amounts[g].value)+1;
    }
}







